package com.itheima.server.service;

import com.itheima.dubbo.api.UserLocationApi;
import com.itheima.model.vo.ErrorResult;
import com.itheima.server.exception.BusinessException;
import com.itheima.server.interceptor.UserHolder;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

@Service
public class BaiduService {
    @DubboReference
    private UserLocationApi userLocationApi;
    //上传/更新地理位置信息
    public void updateLocation(Double longitude, Double latitude, String address){
       Boolean res= userLocationApi.saveUpdate(UserHolder.getUserId(),longitude,latitude,address);
       if(!res){
           throw new BusinessException(ErrorResult.error());
       }
    }
}
